Component({
	data: {
		visible: false,
		fadeIn: false,
		fadeOut: false,
	},
	methods: {
		onMaskTap() {
			this.close()
		},
		open() {
			if (this.data.visible) return
			wx.nextTick(() => {
				this.setData({
					visible: true,
					fadeIn: true,
					fadeOut: false,
				})
			})
		},
		close() {
			if (!this.data.visible) return
			this.setData({
				fadeIn: false,
				fadeOut: true,
			})
			setTimeout(() => {
				this.setData({
					visible: false,
				})
			}, 300)
			this.triggerEvent("close")
		},
		preventTap() {},
	},
})
